#include "Heap.h"

void TestInitAndCreate(Heap * hp,int * arr,int size)
{
	HeapInit(hp);
	HeapCreate(hp, arr, size);
	for (size_t i = 0; i < size; i++)
	{
		printf("%d ",hp->arr[i]);
	}
}
void TestPush(Heap* hp, int* arr, int size)
{
	HeapInit(hp);
	HeapCreate(hp, arr, size);
	HeadPush(hp, 22);
	HeadPush(hp, 54);
	for (size_t i = 0; i < hp->size; i++)
	{
		printf("%d ", hp->arr[i]);
	}
}

void TestPop(Heap* hp, int* arr, int size)
{
	HeapInit(hp);
	HeapCreate(hp, arr, size);
	HeadPush(hp, 22);
	HeadPush(hp, 54);
	for (size_t i = 0; i < hp->size; i++)
	{
		printf("%d ", hp->arr[i]);
	}
	printf("\n");
	HeapPop(hp);
	for (size_t i = 0; i < hp->size; i++)
	{
		printf("%d ", hp->arr[i]);
	}
	printf("\n");
	HeapPop(hp);
	for (size_t i = 0; i < hp->size; i++)
	{
		printf("%d ", hp->arr[i]);
	}
}

void TestOther(Heap* hp, int* arr, int size)
{
	HeapInit(hp);
	HeapCreate(hp, arr, size);
	HeadPush(hp, 22);
	HeadPush(hp, 54);
	for (size_t i = 0; i < hp->size; i++)
	{
		printf("%d ", hp->arr[i]);
	}
	printf("\n");
	printf("堆顶元素为:>%d,堆的元素个数为:%d,堆是否为空:%d\n", HeadTop(hp), HeapSize(hp), HeapEmpty(hp));
	HeapDestory(hp);
}

int main()
{ 
	Heap hp;
	int arr[] = { 23,54,76,33,89,12,78,34,87,10 };
	int size = sizeof(arr) / sizeof(arr[0]);
	//TestInitAndCreate(&hp,arr,size);
	//TestPush(&hp, arr, size);
	//TestPop(&hp, arr, size);
	TestOther(&hp, arr, size);
	return 0;
}